//
// Created by luolijun on 2021/10/31.
//

#ifndef FACADEPAINTERIMPL_H
#define FACADEPAINTERIMPL_H

#include "falcon/ui.h"

#include <QGraphicsView>

namespace falcon {

class FacadePainterImpl : public falcon::Painter {
public:
    FacadePainterImpl();

    void attach(QPainter* p, const QStyleOptionGraphicsItem* o, QWidget* w);
    void detach();

    virtual void drawText(const falcon::RECT& rect, uint32_t style, const char* text) override;
    virtual void drawRect(const falcon::RECT& rect) override;
    virtual void drawLine(const falcon::LINE& line) override;

private:
    QPainter* painter;
    const QStyleOptionGraphicsItem* option;
    QWidget* widget;
};

} // namespace qt
#endif // FACADEPAINTERIMPL_H
